import { RigidBody } from "../behaviours/RigidBody";
import { Behaviour } from "../engine/Behaviour";
import { number } from "../engine/validators/number";

export class WallPrefabBinding extends Behaviour {
    private _x: number = 0;
    @number()
    public get x(): number {
        return this._x;
    }
    public set x(value: number) {
        this._x = value;
        this.invalidateProperties();
    }

    private _y: number = 0;
    @number()
    public get y(): number {
        return this._y;
    }
    public set y(value: number) {
        this._y = value;
        this.invalidateProperties();
    }

    updateProperties() {
        const rigid = this.gameObject.getBehaviour(RigidBody);
        rigid.x = this.x;
        rigid.y = this.y;
    }
}